package com.thh.redisstudy.controller;

import com.thh.redisstudy.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author kaizen
 * @since 2019-07-19
 **/
@RestController
public class RedisController {

    @Autowired
    private RedisTemplate redisTemplate;

    @Resource
    private RedisService redisService;

    @RequestMapping("redis")
    public String getAndSetVal() {
        redisService.set("aaa", "456");
        return (String) redisService.get("aaa");
    }
}
